/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sismol.cartography;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;

/**
 *
 * @author koji
 */
@Entity
public class Linha implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;

    private String nome;

    private List<Trecho> trechos;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    @OneToMany(mappedBy = "linha", targetEntity = Trecho.class)
    @Cascade(org.hibernate.annotations.CascadeType.ALL)
    public List<Trecho> getTrechos() {
        return trechos;
    }

    public void setTrechos(List<Trecho> trechos) {
        this.trechos = trechos;
    }


}
